<template>
    <div>
        <table style="width: 100%;border: solid black 1px">
            <tr v-for="(i,index) in order_ls" :key="index">
                <td @click="$router.push('orderid/?order_id='+i.order_id)">
                    {{i.order_id}}
                </td>
                <td>
                    {{i.total}}
                </td>
            </tr>
        </table>
        <span v-for="i in page_list" :key="i"><button @click="get_info(i)">{{i}}</button></span>
    </div>
</template>

<script>
export default {
    name: "order",
    data(){
        return{
            order_ls: [],
            page_list: [],
            page: 1
        }
    },
    methods:{
        get_info(page){
            this.$axios.get('order/',{
                params:{
                    'token': sessionStorage.getItem('token'),
                    'page': page
                }
            }).then(resp=>{
                console.log(resp.data)
                this.order_ls = resp.data.data
                this.page_list = resp.data.z_pang
            })
        }
    },
    mounted() {
        this.get_info(this.page)
    }
}
</script>

<style scoped>

</style>
